window.onload = function () {
  document.querySelectorAll(".profile-item").forEach(function (value) {
    value.onclick = handleClick
  })
  document.querySelector(".profile-manage").onclick = handleOpenOptionsPage
}

function handleClick(e){
  const id = e.target.dataset.id
  chrome.tabs.create({url: chrome.extension.getURL('page/timeline.html?id=' + id)});
}

function handleOpenOptionsPage() {
  chrome.runtime.openOptionsPage(function callback() {
  })
}